import { Column, Entity, Index, JoinColumn, OneToOne } from 'typeorm';
import { CommonEntity } from '~/common/entity/common.entity';
import { CategoryEntity } from '../category/category.entity';

@Entity({ name: 'ah_knowledge' })
@Index(['id'])
export class KnowledgeEntity extends CommonEntity {
  @Column({ type: 'longtext', comment: 'html内容', nullable: true, name: 'raw_html' })
  rawHtml: string;

  @OneToOne(() => CategoryEntity, (category) => category.knowledge)
	@JoinColumn({ name: 'category_id' })
  category: CategoryEntity;
}
